def solve(nums: list[int]) -> int:
    if not nums:
        return 0
    prev0 = 0
    prev1 = nums[0]
    # 分别为上个房子不打劫和打劫
    for i in range(1,len(nums)):
        cur0 = max(prev0,prev1)
        cur1 = prev0 + nums[i]

        prev0 = cur0
        prev1 = cur1
    return max(cur0,cur1)

if __name__ == "__main__":
    nums = list(map(int, input().split()))
    print(solve(nums))
